﻿using System;
using MessagePack.Formatters;

namespace MessagePack.Internal
{
	// Token: 0x02000117 RID: 279
	internal class AnonymousSerializableFormatter<T> : IMessagePackFormatter<T>
	{
		// Token: 0x0600040B RID: 1035 RVA: 0x0001115B File Offset: 0x0000F55B
		public AnonymousSerializableFormatter(SerializeDelegate<T> serialize)
		{
			this.serialize = serialize;
		}

		// Token: 0x0600040C RID: 1036 RVA: 0x0001116A File Offset: 0x0000F56A
		public int Serialize(ref byte[] bytes, int offset, T value, IFormatterResolver formatterResolver)
		{
			return this.serialize(ref bytes, offset, value, formatterResolver);
		}

		// Token: 0x0600040D RID: 1037 RVA: 0x0001117C File Offset: 0x0000F57C
		public T Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
		{
			throw new NotSupportedException("Anonymous Formatter does not support Deserialize.");
		}

		// Token: 0x040001A7 RID: 423
		private readonly SerializeDelegate<T> serialize;
	}
}
